package com.javacode2018.lesson001.demo22;

import com.javacode2018.lesson001.demo22.test4.ScanBean4;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author: Andy
 * @Date: 2021年11月18日
 * @Description:
 */
public class ComponentScanTest {
//    @Test
//    public void test1() {
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScanBean1.class);
//        for (String beanName : context.getBeanDefinitionNames()) {
//            System.out.println(beanName + "->" + context.getBean(beanName));
//        }
//    }

//    @Test
//    public void test2() {
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScanBean2.class);
//        for (String beanName : context.getBeanDefinitionNames()) {
//            System.out.println(beanName + "->" + context.getBean(beanName));
//        }
//    }

//    @Test
//    public void test3() {
//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScanBean3.class);
//        for (String beanName : context.getBeanDefinitionNames()) {
//            System.out.println(beanName + "->" + context.getBean(beanName));
//        }
//    }

    @Test
    public void test4() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScanBean4.class);
        for (String beanName : context.getBeanDefinitionNames()) {
            System.out.println(beanName + "->" + context.getBean(beanName));
        }
    }
}
